﻿using System;
using Bricks;
using Microsoft.Practices.Prism.Logging;

namespace Motar.Desktop.Logging
{

    /// <summary>
    /// 
    /// </summary>
    public class LoggerFacade : FacadeBase<Bricks.Logging.ILoggerFacade>, ILoggerFacade
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="loggerFacade"></param>
        public LoggerFacade(Bricks.Logging.ILoggerFacade loggerFacade) :
            base(() => loggerFacade)
        {
            if (loggerFacade == null)
            {
                throw new ArgumentNullException("loggerFacade");
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        /// <param name="category"></param>
        /// <param name="priority"></param>
        public virtual void Log(string message, Category category, Priority priority)
        {
            Execute(loggerFacade =>
            {
                switch (category)
                {
                    case Category.Debug:

                        loggerFacade.Debug(message);

                        break;

                    case Category.Exception:

                        loggerFacade.Error(message);

                        break;

                    case Category.Info:

                        loggerFacade.Info(message);

                        break;

                    case Category.Warn:

                        loggerFacade.Warn(message);

                        break;
                }
            });
        }
    }
}
